<?php

class base_facades_view extends base_facades_facade
{
	/**
	 * The view engine instance
	 *
	 * @var base_view_engine
	 */
    private static $__view;

    /**
     * {@inheritDoc}
     */
    protected static function getFacadeAccessor() {
        if (!static::$__view)
        {
            $finder = kernel::single('base_view_finder');

            // 视图编译器
            // $compiler = new base_view_compilers_tramsy();
            $compiler = kernel::single('base_view_compilers_tramsy');
            // 视图引擎
            // $engine = new base_view_engine($compiler);
            $engine = kernel::single('base_view_engine', $compiler);
            static::$__view = new base_view_factory($engine , $finder);
        }
        return static::$__view;
    }

	/**
	 * Return the Request instance, 临时性的用法. 需要抽象ioc
	 *
	 * @var \Symfony\Component\HttpFoundation\Request;
	 */
    public static function getView()
    {
        static::getFacadeAccessor();
        return static::$__view;
    }

}
